<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Axios使用Delete删除数据Restful风格</title>
    <script src="vue.js"></script>
    <script src="axios.min.js"></script>
</head>

<body>
    <div id="app">
        <input type="text" placeholder="请输入部门编号" v-model="deptid">
        <button @click="deleteDept">删除部门信息</button>
    </div>
</body>

</html>
<script>
    var vm = new Vue({
        el: "#app",
        data: {
            url:"http://localhost:8080/depts",
            deptid:""
        },
        methods: {
            deleteDept() {
                axios({
                    url: this.url,
                    method:"DELETE",
                    params:{
                        deptid:this.deptid
                    }
                }).then(res => {
                    console.log(res);
                })
            }
        }
    });
</script>